package com.cfh.microserviceconsumermovie.controller;

import com.cfh.microserviceconsumermovie.service.UploadFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 上传文件
 *
 * @author chenfh
 * @date 2019/7/17
 */
@RestController
public class FileController {
    @Autowired
    private UploadFeignClient feignClient;

    @PostMapping(value = "/file/upload",
            produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public String handlerFileUpload(@RequestPart("file") MultipartFile file) {
        return feignClient.handlerFileUpload(file);
    }
}
